<#include "/default/_inc/_head.html"/>
<#include "/default/_inc/_layout2.html"/>
<!DOCTYPE HTML>
<html lang="${lang}">

<head>
	<@head />
</head>

<body id="blog">
	<@layout>
	<div>
		<div class="toppic">
			<div class="am-container-1">
			</div>
		</div>

		<div class="am-container-1 news-content-all" style="margin-top: 0">
			<div class="left am-u-sm-12 am-u-md-8 am-u-lg-8 " style="padding: 0 10px;border-right: 1px solid #cccccc">
				<ul class="product-show-ul">
					<#include "/default/product-list.html"/>
				</ul>
				<div class="clear"></div>
			</div>

			<div class="left am-u-sm-12 am-u-md-4 am-u-lg-4" style="padding: 0 10px;">
				<div class="am-u-lg-12 am-padding-horizontal-sm">
					<div data-am-widget="titlebar" class="am-titlebar am-titlebar-default am-margin-horizontal-0 am-no-layout">
						<h2 class="am-titlebar-title ">活动推荐</h2>
					</div>
					<div data-am-widget="slider" class="am-slider am-slider-c1 am-no-layout" data-am-slider="{}">

						<div class="am-viewport">
							<ul class="am-slides">
								<@et.ad id="27">
								<#if ads?? && (ads?size> 0) >
								<#list ads as ad>
								<li>
									<a href="<#if ad.adLink??>${ad.adLink}<#else>#</#if>">
										<img src="${ad.adCode}" draggable="false" onerror="this.src='/img/not-img.gif'" />
										<div class="am-slider-desc">${ad.adName}</div>
									</a>
								</li>
									</#list>
								</#if>
								</@et.ad>
							</ul>
						</div>
					</div>
				</div>

				<div class="am-u-lg-12 am-padding-horizontal-sm">
					<div data-am-widget="titlebar" class="am-titlebar am-titlebar-default am-margin-horizontal-0 am-no-layout">
						<h2 class="am-titlebar-title ">技术博推荐</h2>						
					</div>
					<div class="am-list-news-bd">
						<ul class="am-list am-padding-horizontal-xs">
							<#if recommends?? && (recommends?size> 0) >
							<#list recommends as recommend>
							<li class="am-g am-list-item-dated">
								<a class="am-list-item-hd " href="<#if recommend.href??>${recommend.href}<#else>/article/${recommend.articleId}</#if>" title="${recommend.title}">
									${recommend.title}
									<span class="am-list-date">${recommend.createDate?string("yyyy-MM-dd")}</span>
								</a>
							</li>
							</#list>
							</#if>
						</ul>
					</div>
				</div>
				
			</div>

		</div>
		
	</div>
	</@layout>
	<script type="text/javascript">
		//获取滚动条当前的位置
		function getScrollTop() {
			var scrollTop = 0;
			if (document.documentElement && document.documentElement.scrollTop) {
				scrollTop = document.documentElement.scrollTop;
			}
			else if (document.body) {
				scrollTop = document.body.scrollTop;
			}
			return scrollTop;
		}

		//获取当前可是范围的高度
		function getClientHeight() {
			var clientHeight = 0;
			if (document.body.clientHeight && document.documentElement.clientHeight) {
				clientHeight = Math.min(document.body.clientHeight, document.documentElement.clientHeight);
			}
			else {
				clientHeight = Math.max(document.body.clientHeight, document.documentElement.clientHeight);
			}
			return clientHeight;
		}

		//获取文档完整的高度
		function getScrollHeight() {
			return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
		}
		var currentPage = 2;
		var isload = true, loading = false;
		window.onscroll = function () {
			if (!isload) {
				return false;
			}
			if (getScrollTop() + getClientHeight() > getScrollHeight() - $('.footer').height()) {
				if (loading) return;
				loading = true;
				var data = {};
				data.currentPage = currentPage;
				$.ajax({
					type: "POST",
					data: data,
					dataType: 'html',
					url: '/category/dataPage/${categoryId}',
					success: function (res) {
						if (res.trim()) {
							currentPage++;
							$('.product-show-ul').append(res);

						} else {
							//layer.alert(res.message, {icon: 2});
							isload = false;
						}
						loading = false;
					}, error: function (XMLHttpRequest, textStatus, errorThrown) {
						loading = false;
						console.log(errorThrown)
					},
				});
			}
		}
	</script>
</body>

</html>